package org.mango.handler;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.mango.pojo.UnixTime;

/**
 * Created by meigang on 2019/8/8.
 */
public class TimeEncoder extends MessageToByteEncoder<UnixTime> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, UnixTime o, ByteBuf byteBuf) throws Exception {
        byteBuf.writeInt((int)o.value());
    }
}
